﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace JwtAuthorizationSample.Controllers
{
    [Authorize]
    [Produces("application/json")]
    [Route("api/[controller]/[action]")]
    public class DefaultController : Controller
    {
        private readonly IHttpContextAccessor _httpContextAccessor;
        public DefaultController(IHttpContextAccessor httpContextAccessor)
        {
            _httpContextAccessor = httpContextAccessor;
        }
        public IActionResult Get()
        {
            var claims = _httpContextAccessor.HttpContext.User.Claims;
            return Json(claims);
        }
    }
}